using Boo.Lang;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using UnityEngine;

[Serializable]
public class MarchingCube : MonoBehaviour
{
	[Serializable]
	[CompilerGenerated]
	internal sealed class _0024OnTriggerExit_0024402 : GenericGenerator<object>
	{
		internal MarchingCube _0024self__0024404;

		public _0024OnTriggerExit_0024402(MarchingCube self_)
		{
			_0024self__0024404 = self_;
		}

		public override IEnumerator<object> GetEnumerator()
		{
			return new _0024(_0024self__0024404);
		}
	}

	public Transform tr;

	public Material mat;

	public Color startCol;

	public Color riseCol;

	public float offset;

	public int stat;

	public Color color;

	public MarchingCube()
	{
		offset = 0.5f;
	}

	public void Start()
	{
		tr = transform;
		mat = GetComponent<Renderer>().material;
		startCol = mat.color;
	}

	public void OnTriggerStay()
	{
		stat = 1;
		Vector3 localPosition = tr.localPosition;
		float y = Mathf.SmoothStep(localPosition.y, 0.32f, 0.15f);
		Vector3 localPosition2 = tr.localPosition;
		localPosition2.y = y;
		Vector3 vector2 = tr.localPosition = localPosition2;
		Material material = mat;
		Color color = mat.color;
		float r = Mathf.SmoothStep(color.r, riseCol.r, 0.2f);
		Color color2 = mat.color;
		float g = Mathf.SmoothStep(color2.g, riseCol.g, 0.2f);
		Color color3 = mat.color;
		material.color = new Color(r, g, Mathf.SmoothStep(color3.b, riseCol.b, 0.2f));
	}

	public void SetColor()
	{
		if (stat != 1)
		{
			Vector3 localPosition = tr.localPosition;
			float y = Mathf.SmoothStep(localPosition.y, -0.1f, 0.12f);
			Vector3 localPosition2 = tr.localPosition;
			localPosition2.y = y;
			Vector3 vector2 = tr.localPosition = localPosition2;
			Material material = mat;
			Color color = mat.color;
			float r = Mathf.SmoothStep(color.r, startCol.r, 0.2f);
			Color color2 = mat.color;
			float g = Mathf.SmoothStep(color2.g, startCol.g, 0.2f);
			Color color3 = mat.color;
			material.color = new Color(r, g, Mathf.SmoothStep(color3.b, startCol.b, 0.2f));
		}
	}

	public IEnumerator OnTriggerExit()
	{
		return new _0024OnTriggerExit_0024402(this).GetEnumerator();
	}

	public void RandomizeColors()
	{
		startCol = color;
	}

	public void Main()
	{
		InvokeRepeating("SetColor", 0f, 0.04f);
	}
}
